package com.wf.DouDiZhuOL;

import com.wf.DouDiZhuOL.net.http.HttpServer;
import com.wf.DouDiZhuOL.task.ExecutorPool;
import com.wf.DouDiZhuOL.util.Config;

public class ServerUnit {
	public static volatile boolean serverRunning = false;
	
	private HttpServer httpServer;
	
	public void startServer() 
	{
		MainFrame.setText("服务器初始化");
		MainFrame.setText("加载服务器配置文件");
		Config.getInstance().loadAllConfig();
		
		MainFrame.setText("线程池初始化");
		ExecutorPool.getInstance().init();
		
		httpServer = new HttpServer();
		httpServer.startServer();

		serverRunning = true;
	}
	
	public void stopServer() 
	{
		MainFrame.setText("服务器正在关闭。。。");
		
		serverRunning = false;
	}
}
